﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="CPR_Data_Config.aspx.cs" Inherits="System_CPR_Data_Config" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <title>CPR维护</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
    <asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div>
                <table id="wsd_listtable" width="100%">
                    <tr>
                        <td style="width: 100%">
                            <asp:GridView Width="100%" ID="GridView1" runat="server" AutoGenerateColumns="False"  GridLines=None
                                EmptyDataText="没有可显示的数据." EmptyDataRowStyle-Font-Bold="true" EmptyDataRowStyle-HorizontalAlign="Center"
                                OnRowDataBound="Grid_RowDataBound" EnableEmptyContentRender="true" DataKeyNames="ID"
                                BorderWidth="0" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnPageIndexChanging="GridView1_PageIndexChanging"
                                EnableModelValidation="True">
                                <HeaderStyle CssClass="titlist" />
                                <EmptyDataRowStyle HorizontalAlign="Center" Font-Bold="True"></EmptyDataRowStyle>
                                <Columns>
                                     <asp:TemplateField HeaderText="CPR代码" ShowHeader="False">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" OnClientClick="open1()"
                                                CommandName="Select" Text='<%# Eval("CODE") %>'></asp:LinkButton>
                                        </ItemTemplate>
                                        <ControlStyle Font-Underline="False" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="CPR名称" ShowHeader="False" ItemStyle-Width="20%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="false" OnClientClick="open1()"
                                                CommandName="Select" Text='<%# Eval("MEASUREMENTNAME") %>'></asp:LinkButton>
                                        </ItemTemplate>
                                        <ControlStyle Font-Underline="False" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="输入类型" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center"
                                        ShowHeader="False">
                                        <ItemTemplate>
                                            <%# getKPRCPR_InputTYpe(Eval("INPUTTYPE").ToString())%>
                                        </ItemTemplate>
                                        <ControlStyle Font-Underline="False" />
                                    </asp:TemplateField>
                                      <asp:TemplateField HeaderText="是否回显" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center"
                                        ShowHeader="False">
                                        <ItemTemplate>
                                            <b>
                                                <%# (bool)Eval("ISREVIEW") ? "<font size='3' color='green'>√</font>" : "<font size='3' color='red'>×</font>"%>
                                            </b>
                                        </ItemTemplate>
                                        <ControlStyle Font-Underline="False" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="本/竞品显示">
                                        <ItemTemplate>
                                            <%# "1".Equals(Eval("PICKTYPE").ToString().Trim()) ? "本品" :("2".Equals(Eval("PICKTYPE").ToString().Trim())?"竞品":"本/竞品")%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="是否必填">
                                        <ItemTemplate>
                                            <b>
                                                <%# (bool)Eval("ISREQUIRED") ? "<font size='3' color='green'>√</font>" : "<font size='3' color='red'>×</font>"%>
                                            </b>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="修改时间" ItemStyle-HorizontalAlign="Center" ShowHeader="False"
                                        ItemStyle-Width="15%">
                                        <ItemTemplate>
                                            <%#  Jumpton.SFA.Server.BusinessRule.BusinessLogic.GetDateTime(Eval("LAST_UPDATE_TIME").ToString(), "yyyyMMddHHmmss", "yyyy-MM-dd HH:mm:ss")%>
                                        </ItemTemplate>
                                        <ControlStyle Font-Underline="False" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="有效">
                                        <ItemTemplate>
                                            <b>
                                                <%# (bool)Eval("ACTIVE") ? "<font size='3' color='green'>√</font>" : "<font size='3' color='red'>×</font>"%>
                                            </b>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:TemplateField>
                                </Columns>
                                <RowStyle CssClass="evenline" />
                                <AlternatingRowStyle CssClass="oddline" />
                            </asp:GridView>
                        </td>
                    </tr>
                </table>
                <br />
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
            <%--<asp:AsyncPostBackTrigger ControlID="btnCancel" EventName="Click" />--%>
        </Triggers>
    </asp:UpdatePanel>
    <div id="dd" style="width: 350px; height: 380px;">
        <table id="wsd_inputtable" width="100%">
            <tr>
                <td>
                    <asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel2" runat="server">
                        <ContentTemplate>
                            <font color="red"><b>提示: *为必填项</b></font>
                            <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="ObjectDataSource1"
                                DefaultMode="Insert" OnDataBound="DetailsView1_DataBound" EnableModelValidation="True"
                                BorderStyle="None" GridLines="None">
                                <PagerStyle HorizontalAlign="Right"></PagerStyle>
                                <Fields>
                                    <asp:TemplateField HeaderText="序号:" Visible="false">
                                        <ItemTemplate>
                                            <asp:TextBox ID="TextBox4" runat="server" ReadOnly="true" Enabled="false" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="代码:<font color=red>*</font>" HeaderStyle-Width="80">
                                        <ItemTemplate>
                                            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Dynamic"
                                                ErrorMessage="代码不能为空" ControlToValidate="TextBox1"></asp:RequiredFieldValidator><br />
                                        </ItemTemplate>
                                        <HeaderStyle Width="80px" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="名称:<font color=red>*</font>">
                                        <ItemTemplate>
                                            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Display="Dynamic"
                                                ErrorMessage="名称不能为空" ControlToValidate="TextBox2"></asp:RequiredFieldValidator><br />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="输入类型:">
                                        <ItemTemplate>
                                            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                                            </asp:DropDownList>
                                            <br />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="下拉框数据:<br>(一行一值)">
                                        <ItemTemplate>
                                            <asp:TextBox ID="TextBox5" runat="server" TextMode="MultiLine" Height="50px" Text='<% #GetDropdownValue(Eval("ENUM_VALUES")+"") %>'></asp:TextBox>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="最小值:<br>最大值：" Visible="false">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtMinValue" runat="server" Style="ime-mode: disabled" onkeydown="if(event.keyCode==13)event.keyCode=9"
                                                onKeyPress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false"></asp:TextBox>
                                            <br />
                                            <asp:TextBox ID="txtMaxValue" runat="server" Style="ime-mode: disabled" onkeydown="if(event.keyCode==13)event.keyCode=9"
                                                onKeyPress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false"></asp:TextBox><br />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="长度限制：" Visible="false">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtMaxLenght" runat="server" Style="ime-mode: disabled" onkeydown="if(event.keyCode==13)event.keyCode=9"
                                                onKeyPress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false"></asp:TextBox><br />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="推广口味:<br>(一行一值)" Visible="false">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtTGKW" runat="server" TextMode="MultiLine" Height="70px" Text='<% #GetDropdownValue(Eval("VALUETYPE")+"") %>'></asp:TextBox>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="是否回显:">
                                        <ItemTemplate>
                                            <asp:CheckBox runat="server" ID="CheckBox1" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="本/竞品显示:">
                                        <ItemTemplate>
                                            <asp:RadioButtonList ID="rdoList" runat="server" RepeatDirection="Horizontal">
                                                <asp:ListItem Text="本品" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="竞品" Value="2"></asp:ListItem>
                                                <asp:ListItem Text="本/竞品" Value="3"></asp:ListItem>
                                            </asp:RadioButtonList>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="是否必填:">
                                        <ItemTemplate>
                                            <asp:CheckBox runat="server" ID="CheckBox3" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="有效:">
                                        <ItemTemplate>
                                            <asp:CheckBox runat="server" ID="CheckBox2" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Fields>
                                <RowStyle CssClass="tablefield" />
                            </asp:DetailsView>
                            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Jumpton.SFA.Server.Entity.CPR_DATA_CONFIG"
                                DeleteMethod="Save" InsertMethod="Save" SelectMethod="Load" TypeName="Jumpton.SFA.Server.BusinessRule.CPR.CPR_Data_Manager"
                                UpdateMethod="Save">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="GridView1" DefaultValue="" Name="ID" PropertyName="SelectedValue"
                                        Type="Int32" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                            <div style="display: none;">
                                <table id="Table1" style="width: 100%">
                                    <tr>
                                        <td height="10px" width="100%" class="tabletitle">
                                            操作选项
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="buttonarea">
                                            <asp:Button ID="btnSave" runat="server" class="wsd_button2" Text="保  存" OnClick="btnSave_Click" />&nbsp;&nbsp;
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="SelectedIndexChanged" />
                        </Triggers>
                    </asp:UpdatePanel>
                </td>
            </tr>
        </table>
    </div>
    <script type="text/javascript">
        $(function () {
            var dlg = $('#dd').dialog({
                title: 'CRP维护',
                closed: true,
                buttons: [{
                    text: '保存',
                    handler: function () {
                        $get('<%=btnSave.ClientID %>').click();
                    }
                }, {
                    text: '返回',
                    handler: function () {
                        $('#dd').dialog('close');
                    }
                }]
            }); dlg.parent().appendTo(jQuery("form:first"));
        });
        function open1() {
            $('#dd').dialog('open');
        }
        function close1() {
            $('#dd').dialog('close');
        }
    </script>
</asp:Content>
